#include "fs_win.h"
#include <windows.h>
#include "configuration.h"
#include "mounter.h"
#include "ui.h"

Mounter mounter;


FilesystemProvider* CreateSshFromConfig(const Configuration& cfg);

class UserInterfaceConsole : public UserInterface
{
public:
	virtual bool DoQueries(const std::string& from, const std::list<UserQuery*>& queries)
	{
		printf("UI query from '%s'\n", from.c_str());
		for(std::list<UserQuery*>::const_iterator it = queries.begin(); it != queries.end(); ++it) {
			printf("%s\n%s: ", (*it)->Description.c_str(), (*it)->Query.c_str());
			char tmp[10000];
			fgets(tmp, sizeof(tmp), stdin);
			(*it)->Reply = tmp;
			(*it)->Reply.resize((*it)->Reply.size()-1);
		}
		return true;
	}
};

int main()
{
#ifdef WIN32
	WSADATA data;
	WSAStartup(0x0202, &data);
#endif

	UserInterfaceConsole ui;


	Configuration cfg;
	cfg.Add("type", "ssh");
	cfg.Add("mount", "x:\\");
	cfg.Add("name", "PA Dev");
	cfg.Add("server", "carbon.padev.net");
	cfg.Add("auth_sha1", "e9ea5cfce8086fef8350f1e8cfebdd4e0557d262");
	mounter.MountFilesystem(&ui, cfg);
	for(;;)Sleep(100);
}
